/*
 * @(#)HtmlFinderType.java
 *
 *
 *
 * ver 1.0 Aug 16, 2007 ggranum
 */
package org.testfire.model;

import org.testfire.util.DomUtil;
import org.testfire.translator.TranslatorFactory;
import org.w3c.dom.Element;

/**
 * This is a container for an HTMLFinderType.
 */
public class ElementActionType implements TestFireObject
{
    private TestFireObject parent;

    String key;

    String useObjectKey;

    HtmlFinderType htmlFinderType;

    private String keyType;

    public ElementActionType( Element element )
    {
        this.parse( element );
    }

    

    public void setParent( TestFireObject parent )
    {
        this.parent = parent;
    }

    public TestFireObject getParent()
    {
        return parent;
    }

    public void parse( Element el )
    {
        this.key = el.getAttribute( "key" );
        this.keyType = el.getAttribute( "keyType" );
        this.useObjectKey = el.getAttribute( "useObjectKey" );
        /* Should get the object to use here. */
        Element child = DomUtil.getChildElement( el );
        this.htmlFinderType = new HtmlFinderType( child );
    }


    public Object translate( TestsetType testset )
    {
        return TranslatorFactory.translate(testset, this);
    }

    public String getKey()
    {
        return key;
    }

    public String getUseObjectKey()
    {
        return useObjectKey;
    }

    public HtmlFinderType getHtmlFinderType()
    {
        return htmlFinderType;
    }

    public String getKeyType()
    {
        return keyType;
    }
}